﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_Form.cshtml";
}
<form id="form1">
    <div class="container" style="margin-top: 3px; margin-left: 10px; margin-right: 10px;">
        <ul class="nav nav-tabs" role="tablist" id="myTab">
            <li role="presentation"><a href="#basicInfo" role="tab" data-toggle="tab">基本信息</a></li>
        </ul>
        <div class="tab-content">
            <div role="tabpanel" class="tab-pane fade in active" style="padding-top: 5px; margin-right: 104px;margin-left:20px;" id="basicInfo">
                <table class="form">
                    <tr>
                        <td class="formTitle"><span class="required">*</span>组织机构：</td>
                        <td class="formValue formDdlSelectorTd">
                            <select id="OrganizeId" name="OrganizeId" class="form-control required">
                                <option value="">==请选择==</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle"><span class="required">*</span>国临版诊断名称：</td>
                        <td class="formValue">
                            <input id="zdmc" name="zdmc" type="text" class="form-control required" placeholder="请输入名称" />
                        </td>
                    </tr>
                    <tr>
                        <td class="formTitle"><span class="required">*</span>国临版诊断编码：</td>
                        <td class="formValue">
                            <input id="zdCode" name="zdCode" type="text" class="form-control required" placeholder="请输入编码" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">诊断类型：</th>
                        <td class="formValue formDdlSelectorTd">
                            <select id="zdlx" name="zdlx" class="form-control">
                                <option value="">==请选择==</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">ICD10：</th>
                        <td class="formValue">
                            <input id="icd10" name="icd10" type="text" class="form-control" placeholder="" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">ICD10附加码：</th>
                        <td class="formValue">
                            <input id="icd10fjm" name="icd10fjm" type="text" class="form-control" placeholder="" />
                        </td>
                    </tr>
                    @*<tr>
            <th class="formTitle"><span class="required">*</span>国家码：</th>
            <td class="formValue">
                <input id="gjybdm" name="gjybdm" type="text" class="form-control" placeholder="" />
            </td>
        </tr>*@
                    <tr>
                        <th class="formTitle"><span class="required">*</span>首拼：</th>
                        <td class="formValue">
                            <input id="py" name="py" type="text" class="form-control required" placeholder="" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">医保版诊断：</th>
                        <td class="formValue">
                            <input id="zdmc_yb" name="zdmc_yb" type="text" class="form-control" placeholder="" />
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle">医保版编码：</th>
                        <td class="formValue">
                            <input id="zdCode_yb" name="zdCode_yb" type="text" class="form-control" placeholder="" />
                        </td>
                    </tr>
                    @*<tr>
            <th class="formTitle">五笔：</th>
            <td class="formValue">
                <input id="wb" name="wb" type="text" class="form-control" placeholder="" />
            </td>
        </tr>
        <tr>
            <th class="formTitle">排序：</th>
            <td class="formValue">
                <input id="px" name="px" type="text" class="form-control" placeholder="" />
            </td>
        </tr>*@
                    <tr>
                        <th class="formTitle" style="height: 30px;">状态：</th>
                        <td class="formValue" style="padding-top: 1px;">
                            <div class="ckbox">
                                <input id="zt" name="zt" type="checkbox" checked="checked"><label for="zt">有效</label>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <th class="formTitle" style="height: 35px;">慢性病：</th>
                        <td class="formValue" style="padding-top: 1px;">
                            <div class="ckbox">
                                <input id="mxb" name="mxb" type="checkbox" checked="checked"><label for="mxb">有效</label>
                            </div>
                        </td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
</form>

<script>
    var keyValue = $.request("keyValue");
    $(function () {
        initControl();
        if (!!keyValue) {
            $.najax({
                url: "/SysDiagnosis/GetFormJson",
                data: { keyValue: keyValue },
                dataType: "json",
                async: false,
                success: function (data) {
                    $("#form1").formSerialize(data);
                }
            });
        }
    });

    function initControl() {
        //组织机构下拉框
        $("#OrganizeId").bindSelect({
            url: "/Organize/GetChildTreeSelectJson",
            selectedValue: $.request('orgId'),
        });

        //首拼
        $('#zdmc').keyup(function () {
            $('#py').val($(this).toShouPin());
        })

        //诊断类型
        $("#zdlx").bindSelect({
            url: "/ItemsData/GetSelectJson",
            param: { code: "DiagnosisType" }
        });
    }

    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
		}
		debugger
        var postData = $("#form1").formSerialize();
        $.submitForm({
            url: "/SysDiagnosis/SubmitForm?keyValue=" + keyValue,
            param: postData,
            success: function () {
                $.currentWindow().$("#gridList").resetSelection();
                $.currentWindow().$("#gridList").trigger("reloadGrid");
            }
        })
    }
</script>